import http from "@/api";

import { PORT1 } from "@/api/config/servicePort";

// 路由枚举
export const enum RouteType {
  sale = "sale", //消费品
  mro = "mro", //工业品
  food = "food" //食品
}

// 树结构类型
export interface TreeType {
  id?: string;
  value: string | number;
  label: string;
  childs?: TreeType[];
}

//商品单证列表
export const getGoodsDocumentList = (data: Record<string, any>) =>
 http.get(`${PORT1}/goods-certify/certify-list/search`, { ...data }, { loading: false });
 
//申请标签提交
export const postLabelList = (data: Record<string, any>) =>
 http.post(`${PORT1}/km/markings/apply-markings`, { ...data }, { loading: false });
 
//申请标签select列表
export const getLabelList = (data: Record<string, any>) =>
  http.get(`${PORT1}/km/markings/form`, { ...data }, { loading: false });
 
//商品属性列表页树状图
export const getPakingTable = (data: Record<string, any>) =>
 http.get(`${PORT1}/goods-archive/goods-search/paking`, { ...data }, { loading: false });
 
//商家编码
export const getCode = (data: Record<string, any>) =>
  http.get(`${PORT1}/goods-archive/goods-search/bar-code`, { ...data }, { loading: false });

//快速查看的企发销售信息/清关信息
export const getAttribute = (data: Record<string, any>) =>
  http.get(`${PORT1}/goods-archive/goods-search/detail`, { ...data }, { loading: false });

//商家颜色
export const getColor = (data: Record<string, any>) =>
  http.get(`${PORT1}/goods-config/settings/supplier-color/options`, { ...data }, { loading: false });
  
//高级搜索表单
export const getSearcList = (data: Record<string, any>) =>
  http.get(`${PORT1}/goods-archive/goods-search/fields`, { ...data }, { loading: false });

//table表头
export const getTableFields = (data: Record<string, any>,  queueId?: string) =>
  http.get(`${PORT1}/goods-archive/goods-search/table-fields`, { ...data }, {queueId, loading: false });

//table数据
export const getTableData = (data: Record<string, any>, queueId?: string) =>
  http.get(`${PORT1}/goods-archive/goods-search/list`, { ...data }, {queueId, loading: false });

//商品属性列表页树状图
export const getDailyNecessitiesTree = (data: Record<string, any>, queueId?: string) =>
 http.get(`${PORT1}/sys/import-template/goods-type`, { ...data }, {queueId, loading: false });
  







//批量、单个删除
export const batchDeleteApi = (data: Record<string, any>) => {
  return http.post(`${PORT1}/goods-archive/products/delete-product`,{ ...data }, { loading: false });
}


//批量、单个取消审核
export const batchCancelAuditingApi = (data: Record<string, any>) => {
  return http.post(`${PORT1}/goods-archive/products/batch-cancel-check`,
    { ...data }, { loading: false });
}
//批量、单个清关审核
export const batchCustomsClearanceAuditingApi = (data: Record<string, any>) => {
  return http.post(`${PORT1}/goods-archive/products/batch-check`,
    { ...data }, { loading: false });
}


//批量、单个企发属性审核
export const batchQifaAuditingApi = (data: Record<string, any>) => {
  return http.post(`${PORT1}/goods-archive/products/batch-check`,
    { ...data }, { loading: false });
}






//批量、单个编辑企发属性 获取表单属性   --- 表单字段数据
export const getEditQifaPropsForm = (data: Record<string, any>) => {
 
  return http.get(`${PORT1}/goods-archive/products/batch-edit-goodsprops`,
    { ...data }, { loading: false });
}
//批量、单个编辑企发属性和清关属性 获取表单属性   --- 表单字段数据
export const getEditQifaPropsAndClearForm = (data: Record<string, any>) => {
 
  return http.get(`${PORT1}/goods-archive/products/batch-edit-skuprops`,
    { ...data }, { loading: false });
}


//批量、单个编辑企发属性和清关属性  ,获取options 数据   --- 表单 下拉数据
export const getEditQifaPropsAndClearOptions = (data: Record<string, any>) => {
  return http.get(`${PORT1}/goods-archive/products/get-prop-values`,
    { ...data }, { loading: false });
}



//批量、单个编辑企发属性 保存表单、提交，前端批处理会使用这个接口   --- 表单提交
export const saveEditQifaProps = (data: Record<string, any>) => {
  return http.post(`${PORT1}/goods-archive/products/batch-edit-product`,
    { ...data }, { loading: false });
}

//批量、单个编辑企发属性 ,获取options 数据   --- 表单 下拉数据
export const getEditQifaPropsOptions = (data: Record<string, any>) => {
  return http.get(`${PORT1}/goods-archive/products/get-prop-values`,
    { ...data }, { loading: false });
}







//批量、单个 编辑清关属性 获取表单属性    --- 表单字段数据
export const getEditClearancePropsForm = (data: Record<string, any>) => {
  return http.get(`${PORT1}/goods-archive/products/batch-edit-goodsccprops`,
    { ...data }, { loading: false });
}

//批量、单个 编辑清关属性 保存表单 ，前端批处理会使用这个接口    --- 表单提交
export const saveBatchEditClearanceProps = (data: Record<string, any>) => {
  return http.post(`${PORT1}/goods-archive/products/batch-edit-product`,
    { ...data }, { loading: false });
}

//批量、单个 编辑清关属性 ,获取options 数据    --- 表单 下拉数据
export const getBatchEditClearancePropsOptions = (data: Record<string, any>) => {
  return http.get(`${PORT1}/goods-archive/products/get-prop-values`,
    { ...data }, { loading: false });
}

 